package org.arch_learn.servlet_container.utils;

public class HttpProtocolUtil {
    public static String getHttp200ResponseHeader(Integer length) {
        String responseHeader =
                "HTTP/1.1 200 OK \n" +
                        "Content-Type: text/html; charset=utf-8\n" +
                        "Content-Length: " + length + "\n" +
                        "\r\n";
        return responseHeader;
    }

    public static String getHttp404Response() {
        String str404 = "<h1>404 Not Found</h1>";
        String response =
                "HTTP/1.1 404 Not Found \n" +
                        "Content-Type: text/html; charset=utf-8\n" +
                        "Content-Length: " + str404.getBytes().length + "\n" +
                        "\r\n" + str404;
        return response;
    }
}
